<template>
  <div class="baseTree">
    <vxe-table
      ref="treeDataRef"
      :data="treeData"
      show-overflow
      height="auto"
      border="none"
      :show-header="false"
      :row-config="{ height: 38, isCurrent: true, isHover: true }"
      :tree-config="{
          children: 'children',
          iconOpen: 'vxe-icon-square-minus',
          iconClose: 'vxe-icon-square-plus',
          expandAll: true,
          reserve: true
          // transform  使用 flgTreeData ChildrenToParentData() 转化后才能使用
          // transform: true,
        }"
      @current-change="currentChange"
    >
      <vxe-table-column field="name" width="100%" title="全部数据" tree-node>
        <template #default="{ row }">
          <!--          <Icon :type="treeData.isTreeExpandByRow(row)? 'ios-folder-open' : 'ios-folder'"/>-->
          {{ row.name }}
        </template>
      </vxe-table-column>
    </vxe-table>
  </div>
</template>

<script>
export default {
  name: "BaseTree",
  props: {
    treeData: {
      type: Array,
      default: () => {
        return [];
      }
    }
  },
  data() {
    return {};
  },
  methods: {
    currentChange({row}) {
      this.$emit("getBaseTreeCurrentChange", row);
    }
  }
};
</script>

<style scoped lang="less">
.baseTree {
  width: 100%;
  height: 300px;
}
</style>